package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.pojo.meetingRoomPojo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface meetingRoomMapp {

    @DS("newMscLowCodeTest")
    @Delete("DELETE FROM ddm_meeting_room WHERE id = #{id}")
    void deleteMeetingRoom(String id); // 新增删除方法

    @DS("newMscLowCodeTest")
    @Insert("INSERT INTO ddm_meeting_room (" +
            "id, create_time, update_time, creator, process_status, sys_update_user, " +
            "sys_audit_user, sys_audit_time, sys_deleted,  " +
            "meetingRoomData, meetingRoomTime, meetingRoomTopic, meetingRoomCancel,meetingRoomTimeEnd" +
            ") VALUES (" +
            "#{id}, #{create_time}, #{update_time}, #{creator}, #{process_status}, #{sys_update_user}, " +
            "#{sys_audit_user}, #{sys_audit_time}, #{sys_deleted}, " +
            "#{meetingRoomData}, #{meetingRoomTime}, #{meetingRoomTopic}, #{meetingRoomCancel},#{meetingRoomTimeEnd}" +
            ")")
    void insertOne(meetingRoomPojo meetingRoomPojo);

    @DS("newMscLowCodeTest")
    @Select("select * from ddm_meeting_room where sys_deleted=0")
    List<meetingRoomPojo> queryAll();

    @DS("newMscLowCodeTest")
    @Update("UPDATE ddm_meeting_room SET " +
            "update_time = #{update_time}, " +
            "creator = #{creator}, " +
            "process_status = #{process_status}, " +
            "sys_update_user = #{sys_update_user}, " +
            "sys_audit_user = #{sys_audit_user}, " +
            "sys_audit_time = #{sys_audit_time}, " +
            "sys_deleted = #{sys_deleted}, " +
            "meetingRoomData = #{meetingRoomData}, " +
            "meetingRoomTime = #{meetingRoomTime}, " +  // 修正了拼写错误
            "meetingRoomTopic = #{meetingRoomTopic}, " +
            "meetingRoomCancel = #{meetingRoomCancel}, " +  // 添加逗号
            "meetingRoomTimeEnd = #{meetingRoomTimeEnd} " +  // 修正字段名
            "WHERE id = #{id} AND sys_deleted = 0")
    void updateMeetingRoom(meetingRoomPojo meetingRoomPojo);
}
